package com.gitee.aurora.config;

import com.gitee.aurora.client.WebSocketClent;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

import java.net.URISyntaxException;


/**
 * author: jiangfuxiao
 * Date:2022/9/6 10:37
 */
@Configuration
public class ApplicationConfig {
    @Bean
    RestTemplate restTemplate(){
        return new RestTemplate();
    }



    /*首先在该类中注入一个ServerEndpointExporter的bean,
     *ServerEndpointExporter这个bean会自动注册使用了@ServerEndpoint这个注解的websocket endpoint
     */
    @Bean
    public ServerEndpointExporter serverEndpointExporter(){
        return new ServerEndpointExporter();
    }


    @Bean
    public WebSocketClent webSocketClent() throws URISyntaxException {
        return new WebSocketClent();
    }

}
